/* 暗黑主题样式 */
:root {
  /* 暗黑主题颜色变量 */
  --dark-bg-primary: #1a1a1a;
  --dark-bg-secondary: #2d2d2d;
  --dark-bg-tertiary: #3a3a3a;
  --dark-bg-card: #242424;
  --dark-text-primary: #e0e0e0;
  --dark-text-secondary: #b0b0b0;
  --dark-text-muted: #808080;
  --dark-border: #404040;
  --dark-border-light: #505050;
  --dark-shadow: rgba(0, 0, 0, 0.3);
  --dark-shadow-light: rgba(0, 0, 0, 0.2);
  
  /* 主题色 - 更柔和的色调 */
  --dark-primary: #4a9eff;
  --dark-success: #5cb85c;
  --dark-warning: #f0ad4e;
  --dark-danger: #d9534f;
  --dark-info: #5bc0de;
  
  /* 渐变背景 */
  --dark-gradient-primary: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  --dark-gradient-secondary: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 100%);
  --dark-gradient-accent: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
}

/* 暗黑主题全局样式 */
body.dark-theme {
  background: var(--dark-gradient-primary);
  color: var(--dark-text-primary);
}

body.dark-theme #app {
  background: var(--dark-bg-primary);
}

/* 暗黑主题下的卡片 */
body.dark-theme .el-card {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
  box-shadow: 0 4px 12px var(--dark-shadow);
}

body.dark-theme .el-card__header {
  border-bottom: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

/* 暗黑主题下的表格 */
body.dark-theme .el-table {
  background: var(--dark-bg-card);
  color: var(--dark-text-primary);
  border: 1px solid var(--dark-border);
}

body.dark-theme .el-table th {
  background: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
  border-bottom: 1px solid var(--dark-border);
}

body.dark-theme .el-table tr {
  background: var(--dark-bg-card);
  color: var(--dark-text-primary);
  border-bottom: 1px solid var(--dark-border-light);
}

body.dark-theme .el-table tr:hover {
  background: var(--dark-bg-tertiary);
}

/* 暗黑主题下的输入框 */
body.dark-theme .el-input__inner {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

body.dark-theme .el-input__inner:focus {
  border-color: var(--dark-primary);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

body.dark-theme .el-input__inner::placeholder {
  color: var(--dark-text-muted);
}

/* 暗黑主题下的按钮 */
body.dark-theme .el-button {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

body.dark-theme .el-button--primary {
  background: var(--dark-gradient-accent);
  border-color: var(--dark-primary);
}

body.dark-theme .el-button--success {
  background: var(--dark-success);
  border-color: var(--dark-success);
}

body.dark-theme .el-button--warning {
  background: var(--dark-warning);
  border-color: var(--dark-warning);
}

body.dark-theme .el-button--danger {
  background: var(--dark-danger);
  border-color: var(--dark-danger);
}

body.dark-theme .el-button--info {
  background: var(--dark-info);
  border-color: var(--dark-info);
}

/* 暗黑主题下的选择器 */
body.dark-theme .el-select .el-input__inner {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

body.dark-theme .el-select-dropdown {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 12px var(--dark-shadow);
}

body.dark-theme .el-select-dropdown__item {
  color: var(--dark-text-primary);
}

body.dark-theme .el-select-dropdown__item:hover {
  background: var(--dark-bg-tertiary);
}

body.dark-theme .el-select-dropdown__item.selected {
  background: var(--dark-primary);
  color: white;
}

/* 暗黑主题下的标签 */
body.dark-theme .el-tag {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

body.dark-theme .el-tag.el-tag--success {
  background: rgba(92, 184, 92, 0.2);
  border-color: var(--dark-success);
  color: var(--dark-success);
}

body.dark-theme .el-tag.el-tag--warning {
  background: rgba(240, 173, 78, 0.2);
  border-color: var(--dark-warning);
  color: var(--dark-warning);
}

body.dark-theme .el-tag.el-tag--danger {
  background: rgba(217, 83, 79, 0.2);
  border-color: var(--dark-danger);
  color: var(--dark-danger);
}

body.dark-theme .el-tag.el-tag--info {
  background: rgba(91, 192, 222, 0.2);
  border-color: var(--dark-info);
  color: var(--dark-info);
}

/* 暗黑主题下的对话框 */
body.dark-theme .el-dialog {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 12px 32px var(--dark-shadow);
}

body.dark-theme .el-dialog__title {
  color: var(--dark-text-primary);
}

body.dark-theme .el-dialog__body {
  color: var(--dark-text-secondary);
}

/* 暗黑主题下的头部 */
body.dark-theme .header-content {
  background: var(--dark-gradient-secondary);
  border-bottom: 1px solid var(--dark-border);
}

body.dark-theme .header-title {
  color: var(--dark-text-primary);
  text-shadow: 0 2px 4px var(--dark-shadow);
}

/* 暗黑主题下的统计卡片 */
body.dark-theme .stat-card {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 12px var(--dark-shadow);
}

body.dark-theme .stat-card:hover {
  box-shadow: 0 8px 24px var(--dark-shadow-light);
}

body.dark-theme .stat-card.present:hover {
  border-color: var(--dark-success);
  background-color: rgba(92, 184, 92, 0.1);
}

body.dark-theme .stat-card.absent:hover {
  border-color: var(--dark-danger);
  background-color: rgba(217, 83, 79, 0.1);
}

body.dark-theme .stat-card.leave:hover {
  border-color: var(--dark-warning);
  background-color: rgba(240, 173, 78, 0.1);
}

/* 暗黑主题下的批量操作栏 */
body.dark-theme .batch-operation-bar {
  background: var(--dark-gradient-secondary);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 20px var(--dark-shadow);
}

/* 暗黑主题下的寝室卡片 */
body.dark-theme .room-card {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 12px var(--dark-shadow);
}

body.dark-theme .room-card:hover {
  box-shadow: 0 8px 24px var(--dark-shadow-light);
}

body.dark-theme .room-header {
  border-bottom: 1px solid var(--dark-border);
}

body.dark-theme .room-number {
  color: var(--dark-text-primary);
}

body.dark-theme .room-actions {
  border-top: 1px solid var(--dark-border);
}

/* 暗黑主题下的滚动条 */
body.dark-theme ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.dark-theme ::-webkit-scrollbar-track {
  background: var(--dark-bg-secondary);
  border-radius: 4px;
}

body.dark-theme ::-webkit-scrollbar-thumb {
  background: var(--dark-border-light);
  border-radius: 4px;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: var(--dark-border);
}

/* 暗黑主题下的加载动画 */
body.dark-theme .loading-spinner {
  border: 3px solid var(--dark-bg-secondary);
  border-top: 3px solid var(--dark-primary);
}

/* 暗黑主题下的描述列表 */
body.dark-theme .el-descriptions {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  border-radius: 8px;
}

body.dark-theme .el-descriptions__title {
  color: var(--dark-text-primary);
}

body.dark-theme .el-descriptions-item__label {
  background: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
}

body.dark-theme .el-descriptions-item__content {
  background: var(--dark-bg-card);
  color: var(--dark-text-secondary);
}

/* 暗黑主题下的分页器 */
body.dark-theme .el-pagination .btn-prev,
body.dark-theme .el-pagination .btn-next {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

body.dark-theme .el-pagination .el-pager li {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

body.dark-theme .el-pagination .el-pager li.active {
  background: var(--dark-primary);
  color: white;
}

/* 暗黑主题下的通知 */
body.dark-theme .el-notification {
  background: var(--dark-bg-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 8px 24px var(--dark-shadow);
}

body.dark-theme .el-notification__title {
  color: var(--dark-text-primary);
}

body.dark-theme .el-notification__content {
  color: var(--dark-text-secondary);
}

/* 暗黑主题切换按钮 */
.theme-toggle-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

body.dark-theme .theme-toggle-btn {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

/* 暗黑主题下的主要文本颜色 */
body.dark-theme .student-id,
body.dark-theme .student-name,
body.dark-theme .dormitory-number {
  color: var(--dark-text-primary);
}

body.dark-theme .card-title {
  color: var(--dark-text-primary);
}

/* 暗黑主题下的边框和分隔线 */
body.dark-theme .room-actions {
  border-top-color: var(--dark-border);
}

body.dark-theme .el-table__row {
  border-bottom-color: var(--dark-border-light);
}

body.dark-theme .el-table__row:hover {
  background-color: var(--dark-bg-tertiary);
}

/* 暗黑主题下的Element Plus布局组件 */
body.dark-theme .el-container {
  background: var(--dark-bg-primary);
}

body.dark-theme .el-header {
  background: var(--dark-gradient-secondary);
  color: var(--dark-text-primary);
}

body.dark-theme .el-main {
  background: var(--dark-bg-primary);
  color: var(--dark-text-primary);
}

/* 暗黑主题下的全局背景 */
body.dark-theme {
  background: var(--dark-bg-primary) !important;
}

body.dark-theme #app {
  background: var(--dark-bg-primary) !important;
  min-height: 100vh;
}

/* 覆盖Element Plus的默认白色背景 */
body.dark-theme .el-container,
body.dark-theme .el-aside,
body.dark-theme .el-footer {
  background-color: var(--dark-bg-primary) !important;
}

/* 暗黑主题下的卡片头部 */
body.dark-theme .el-card__header {
  background: var(--dark-bg-secondary);
  border-bottom: 1px solid var(--dark-border);
}

/* 暗黑主题下的统计项 */
body.dark-theme .stat-item {
  color: var(--dark-text-primary);
}

body.dark-theme .stat-label {
  color: var(--dark-text-secondary);
}

body.dark-theme .stat-number {
  color: var(--dark-text-primary);
}

/* 暗黑主题下的按钮组 */
body.dark-theme .el-button-group .el-button {
  border-color: var(--dark-border);
}

/* 暗黑主题下的输入框组 */
body.dark-theme .el-input-group__prepend,
body.dark-theme .el-input-group__append {
  background: var(--dark-bg-secondary);
  border-color: var(--dark-border);
  color: var(--dark-text-primary);
}

/* 暗黑主题下的进度条 */
body.dark-theme .el-progress-bar__outer {
  background: var(--dark-bg-secondary);
}

/* 暗黑主题下的空状态 */
body.dark-theme .el-empty__description {
  color: var(--dark-text-secondary);
}

body.dark-theme .el-empty__image {
  filter: brightness(0.7);
}

/* 暗黑主题下的表格样式 */
body.dark-theme .el-table {
  background-color: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
}

body.dark-theme .el-table th {
  background-color: var(--dark-bg-tertiary);
  color: var(--dark-text-primary);
}

body.dark-theme .el-table tr {
  background-color: var(--dark-bg-secondary);
}

body.dark-theme .el-table td {
  background-color: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
  border-bottom-color: var(--dark-border);
}

body.dark-theme .el-table--striped .el-table__body tr.el-table__row--striped td {
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-table__header-wrapper {
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-table__body-wrapper {
  background-color: var(--dark-bg-secondary);
}

/* 暗黑主题下的分页器 */
body.dark-theme .el-pagination {
  background-color: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
}

body.dark-theme .el-pagination button {
  background-color: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
  border-color: var(--dark-border);
}

body.dark-theme .el-pagination .el-pager li {
  background-color: var(--dark-bg-secondary);
  color: var(--dark-text-primary);
  border-color: var(--dark-border);
}

body.dark-theme .el-pagination .el-pager li.active {
  background-color: var(--dark-color-primary);
  color: white;
}

/* 暗黑主题下的选择器 */
body.dark-theme .el-select-dropdown {
  background-color: var(--dark-bg-secondary);
  border-color: var(--dark-border);
}

body.dark-theme .el-select-dropdown__item {
  color: var(--dark-text-primary);
}

body.dark-theme .el-select-dropdown__item.hover,
body.dark-theme .el-select-dropdown__item:hover {
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-select-dropdown__item.selected {
  color: var(--dark-color-primary);
  background-color: var(--dark-bg-tertiary);
}

/* 暗黑主题下的日期选择器 */
body.dark-theme .el-date-picker {
  background-color: var(--dark-bg-secondary);
  border-color: var(--dark-border);
}

body.dark-theme .el-date-picker__header {
  background-color: var(--dark-bg-tertiary);
  border-bottom-color: var(--dark-border);
}

body.dark-theme .el-date-picker__header-label {
  color: var(--dark-text-primary);
}

body.dark-theme .el-picker-panel__content {
  background-color: var(--dark-bg-secondary);
}

body.dark-theme .el-date-table th {
  color: var(--dark-text-secondary);
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-date-table td.available {
  color: var(--dark-text-primary);
}

body.dark-theme .el-date-table td.today {
  color: var(--dark-color-primary);
}

body.dark-theme .el-date-table td.current:not(.disabled) {
  background-color: var(--dark-color-primary) !important;
  color: white !important;
}

/* 暗黑主题下的对话框 */
body.dark-theme .el-dialog {
  background-color: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.dark-theme .el-dialog__title {
  color: var(--dark-text-primary);
}

body.dark-theme .el-dialog__body {
  color: var(--dark-text-primary);
}

body.dark-theme .el-dialog__footer {
  background-color: var(--dark-bg-tertiary);
  border-top: 1px solid var(--dark-border);
}

/* 暗黑主题下的消息提示 */
body.dark-theme .el-message {
  background-color: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.dark-theme .el-message__content {
  color: var(--dark-text-primary);
}

/* 暗黑主题下的消息通知 */
body.dark-theme .el-notification {
  background-color: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.dark-theme .el-notification__title {
  color: var(--dark-text-primary);
}

body.dark-theme .el-notification__content {
  color: var(--dark-text-secondary);
}

/* 暗黑主题下的消息框 */
body.dark-theme .el-message-box {
  background-color: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.dark-theme .el-message-box__title {
  color: var(--dark-text-primary);
}

body.dark-theme .el-message-box__message {
  color: var(--dark-text-primary);
}

body.dark-theme .el-message-box__content {
  color: var(--dark-text-secondary);
}

/* 暗黑主题下的开关 */
body.dark-theme .el-switch__core {
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-switch.is-checked .el-switch__core {
  background-color: var(--dark-color-primary);
}

/* 暗黑主题下的滑块 */
body.dark-theme .el-slider__runway {
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-slider__bar {
  background-color: var(--dark-color-primary);
}

body.dark-theme .el-slider__button {
  background-color: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
}

/* 暗黑主题下的时间选择器 */
body.dark-theme .el-time-picker {
  background-color: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
}

body.dark-theme .el-time-spinner__item {
  color: var(--dark-text-primary);
}

body.dark-theme .el-time-spinner__item:hover {
  background-color: var(--dark-bg-tertiary);
}

body.dark-theme .el-time-spinner__item.active {
  color: var(--dark-color-primary);
  background-color: var(--dark-bg-tertiary);
}

/* 暗黑主题下的复选框 */
body.dark-theme .el-checkbox__inner {
  background-color: var(--dark-bg-secondary);
  border-color: var(--dark-border);
}

body.dark-theme .el-checkbox__input.is-checked .el-checkbox__inner {
  background-color: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
}

body.dark-theme .el-checkbox__label {
  color: var(--dark-text-primary);
}

/* 暗黑主题下的单选框 */
body.dark-theme .el-radio__inner {
  background-color: var(--dark-bg-secondary);
  border-color: var(--dark-border);
}

body.dark-theme .el-radio__input.is-checked .el-radio__inner {
  background-color: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
}

body.dark-theme .el-radio__label {
  color: var(--dark-text-primary);
}

/* 暗黑主题下的全局覆盖样式 */
body.dark-theme .dormitory-check-app {
  background: var(--dark-bg-primary) !important;
}

body.dark-theme .app-header {
  background: var(--dark-gradient-secondary) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}

body.dark-theme .header-content h1 {
  color: var(--dark-text-primary) !important;
}

body.dark-theme .stat-card {
  background-color: var(--dark-bg-secondary) !important;
  border-color: var(--dark-border) !important;
}

body.dark-theme .stat-card.present {
  background-color: var(--dark-bg-secondary) !important;
  border-color: var(--dark-color-success) !important;
}

body.dark-theme .stat-card.absent {
  background-color: var(--dark-bg-secondary) !important;
  border-color: var(--dark-color-danger) !important;
}

body.dark-theme .stat-card.leave {
  background-color: var(--dark-bg-secondary) !important;
  border-color: var(--dark-color-warning) !important;
}

body.dark-theme .stat-card.delay {
  background-color: var(--dark-bg-secondary) !important;
  border-color: var(--dark-color-info) !important;
}

body.dark-theme .stat-number {
  color: var(--dark-text-primary) !important;
}

body.dark-theme .stat-label {
  color: var(--dark-text-secondary) !important;
}

body.dark-theme .batch-operation-bar {
  background: var(--dark-gradient-primary) !important;
}

body.dark-theme .progress-text {
  color: var(--dark-text-primary) !important;
}

/* 增强进度条中span文字的对比度 */
body.dark-theme .el-progress__text span {
  color: var(--dark-text-primary) !important;
  font-weight: 600 !important;
}

/* 确保所有进度条内的span都有良好对比度 */
body.dark-theme .el-progress .el-progress__text span {
  color: var(--dark-text-primary) !important;
  font-weight: 600 !important;
}

/* 增强进度条中span文字的对比度 */
body.dark-theme .el-progress__text span {
  color: var(--dark-text-primary) !important;
  font-weight: 600 !important;
}

/* 确保所有进度条内的span都有良好对比度 */
body.dark-theme .el-progress .el-progress__text span {
  color: var(--dark-text-primary) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .summary-chart h4,
body.dark-theme .weekly-chart h4 {
  color: var(--dark-text-primary) !important;
}

/* 暗黑主题下的滚动条 */
body.dark-theme ::-webkit-scrollbar-track {
  background: var(--dark-bg-tertiary);
}

body.dark-theme ::-webkit-scrollbar-thumb {
  background: var(--dark-border);
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: var(--dark-text-secondary);
}